// hyb_yl/mysubpages/pages/serviceset/serviceset.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    title: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options);
    var that = this;
    var state = options.state;
    that.setData({
      title:options.title
    })
    // if (state == 1) {
    //   that.setData({
    //     title: "图文问诊"
    //   })
    // } else if (state == 2) {
    //   that.setData({
    //     title: "在线开方"
    //   })
    // } else if (state == 3) {
    //   that.setData({
    //     title: "报告解读"
    //   })
    // } else if (state == 4) {
    //   that.setData({
    //     title: "视频问诊"
    //   })
    // } else if (state == 5) {
    //   that.setData({
    //     title: "电话问诊"
    //   })
    // } else if (state == 6) {
    //   that.setData({
    //     title: "实时会话"
    //   })
    // } else if (state == 7) {
    //   that.setData({
    //     title: "手术安排"
    //   })
    // } else if (state == 8) {
    //   that.setData({
    //     title: "其他服务"
    //   })
    // }
    var ids = options.ids
    app.util.request({
      url: 'entry/wxapp/zhuanjia.server_detail',
      data: {
        ids: ids
      },
      success: function (res) {
        console.log(res)
        that.setData({
          detail: res.data
        })
      }
    })
    that.setData({
      ids: ids
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  formSubmit(e) {
    console.log(e)
    var that = this
    var ids = that.data.ids
    var ptmoney = e.detail.value.ptmoney
    var ptzhuiw = e.detail.value.ptzhuiw
    var hymoney = e.detail.value.hymoney
    var hyzhuiw = e.detail.value.hyzhuiw
    app.util.request({
      url: 'entry/wxapp/zhuanjia.update_detail',
      data: {
        ids: ids,
        ptmoney: ptmoney,
        ptzhuiw: ptzhuiw,
        hymoney: hymoney,
        hyzhuiw: hyzhuiw
      },
      success: function (res) {
        console.log(res)
        wx.showToast({
          title: '编辑成功',
          icon: 'none'
        })
        wx.navigateBack({
          complete: (res) => {},
        })
      }
    })
  }
})